﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Demo.Util
{
    public partial class Logger : Form
    {
        public Logger()
        {
            InitializeComponent();
            log = new Cocon90.Lib.Util.Logger(Application.StartupPath + "\\log\\");
        }
        Cocon90.Lib.Util.Logger log;
        private void button2_Click(object sender, EventArgs e)
        {
            log.addToLog(textBox1.Text);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                var num = 0;
                var v = 5 / num;
            }
            catch (Exception ex)
            {
                log.addToLog(ex);
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = log.LogDirectory + DateTime.Now.Year + "年" + DateTime.Now.Month + "月" + DateTime.Now.Day + "日.txt";
            if (System.IO.File.Exists(path))
                richTextBox1.Text = System.IO.File.ReadAllText(path);
        }
    }
}
